'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, middleware } = app;
  const auth = middleware.auth;
  //注册用户
  router.post('/user', controller.user.createUser)
  //创建订单
  router.post("/order", auth(), controller.order.createOrder)
  //获取订单列表
  router.get("/order", controller.order.getOrders)
  //获取订单详情
  router.get("/order/:id", controller.order.getOrderById)
  //获取我的订单
  router.get("/myorder", auth(), controller.order.getMyOrder)
  //加入剧本
  router.post("/order/:id", auth(), controller.userorder.join)
  //退出剧本
  router.delete("/order/:id",auth(),controller.userorder.quit)
};